import { Field, Float, Int, ObjectType } from "@nestjs/graphql";
import { BaseEntity } from "../base.entity/base.entity";
import { Teacher } from "@prisma/client";
import { TeacherOnClassesEntity } from "../teacher.on.classes.entity/teacher.on.classes.entity";
import { TaskOnTeacherItemEntity } from "../task.on.teacher.item.entity/task.on.teacher.item.entity";

@ObjectType()
class AnalysisItem {
    @Field()
    name: number

    @Field(() => Float)
    avg: number
}
@ObjectType()
export class TeacherCountEntity {
    @Field(() => Int)
    TeacherOnClasses: number
}

@ObjectType()
export class TeacherEntity extends BaseEntity implements Teacher {
    @Field(() => [TeacherOnClassesEntity], { nullable: true })
    TeacherOnClasses?: TeacherOnClassesEntity[]

    @Field()
    name: string

    @Field(() => [AnalysisItem], { nullable: true })
    items?: AnalysisItem[]

    @Field(() => [TaskOnTeacherItemEntity], { nullable: true })
    TaskOnTeacherItem?: TaskOnTeacherItemEntity[]

    @Field(() => TeacherCountEntity, { nullable: true })
    _count?: TeacherCountEntity
}
